<%@ include file="/WEB-INF/pages/common/taglibs.jsp" %>
<%@ include file="/WEB-INF/pages/common/checkpermission.jsp" %>
<%@ include file="/WEB-INF/pages/cases/manual/checkManualAddPermission.jsp" %>
<codelookup:codeCollection id="deptList" codeType="DEPT_LIST"/>
<codelookup:codeCollection id="typeList" codeType="CODE_TYPE" filterName="CODE_FILTER" filterParams="MANUAL_ADD_TYPE"/>
<codelookup:codeCollection id="trueFalseList" codeType="CODE_TYPE"  filterName="CODE_FILTER" filterParams="TRUE_FALSE_LIST"/>

<script type="text/javascript">
    function manualAdd(){
       submitForm("addForm", "addLight.action"); 
    }

    function manualCancel(){
       submitForm("addForm", "../clientSummary.action");
    }

     function changeCaseType(){
       var currentForm = document.forms["addForm"];
        var caseType=currentForm.elements["caseLightModel.caseType"].value;
         if(caseType=="01"){
             document.getElementById("light").src="<c:url value="/images/red.png"/>";
        }else if(caseType=="02"){
             document.getElementById("light").src="<c:url value="/images/purple.png"/>";
        }else if(caseType=="03"){
             document.getElementById("light").src="<c:url value="/images/yellow.png"/>";
        }else if(caseType=="04"){
             document.getElementById("light").src="<c:url value="/images/purple.png"/>";
        }else if(caseType=="05"){
             document.getElementById("light").src="<c:url value="/images/blue.png"/>";
        }else if(caseType=="06"){
             document.getElementById("light").src="<c:url value="/images/white.png"/>";
        }
        if(caseType=="05"){
            document.getElementById("pplInd").style.display="";
            document.getElementById("procInd").style.display="";
        }else{
            document.getElementById("pplInd").style.display="none";
            document.getElementById("procInd").style.display="none";
            document.getElementById("caseLightModel.pplInd").value="N";
            document.getElementById("caseLightModel.procInd").value="N";
        }
    }

    function changeCaseFivePpl(){
        if(document.getElementById("caseLightModel.pplInd").value=="N"){
            document.getElementById("caseLightModel.procInd").value="N";
            document.getElementById("light").src="<c:url value="/images/blue.png"/>";
        }else{
            if(document.getElementById("caseLightModel.procInd").value=="Y"){
                     document.getElementById("light").src="<c:url value="/images/red.png"/>";
                }else{
                     document.getElementById("light").src="<c:url value="/images/yellow.png"/>";                       
                }
        }

    }
                                               
    function changeCaseFiveProc(){
            if(document.getElementById("caseLightModel.procInd").value=="Y"){
                document.getElementById("caseLightModel.pplInd").value="Y";
                document.getElementById("light").src="<c:url value="/images/red.png"/>";
            }else{
                if(document.getElementById("caseLightModel.pplInd").value=="Y"){
                     document.getElementById("light").src="<c:url value="/images/yellow.png"/>";
                }else{
                     document.getElementById("light").src="<c:url value="/images/blue.png"/>";                       
                }

            }

    }

</script>

<s:form name="addForm">
    <table align="center" cellpadding="0" cellspacing="0" class="body_content full_width">
        <tr>
            <td align="left" valign="bottom" class="main_page_content_icon" width="4%">
                <img src='<c:url value="/images/body-icon_check.gif"/>' width="29" height="44">
            </td>
            <td valign="bottom" class="page_title_bg" width="96%"><span class="page_title">
                <s:text name="label.title.manualadd"/></span></td>
        </tr>
        <tr>
            <td class="subcontent" colspan="2">&nbsp;</td>
        </tr>
    </table>
    <table border="0" align="center" cellpadding="0" cellspacing="0" class="body_content full_width bordered">
        <tr class="section_title">
            <td class="section_title" colspan="3">
                <font size="5"><s:text name="label.add.casesix.section1"/></font></td>
        </tr>
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.deptName"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                <s:select list="#attr.deptList" name="caseLightModel.deptId" listKey="codeId" listValue="codeDesc"/>
            </td>
        </tr>
        <tr class="even">
            <td class="form_label_padded" width="10%" nowrap valign="top"><s:text name="label.title.manual.infotype"/></td>
            <td class="form_label_padded" width="2%" valign="top">:</td>
            <td class="txtData" align="left">
                <s:select list="#attr.typeList" name="caseLightModel.caseType" listKey="codeId" listValue="codeDesc" onchange="changeCaseType();"/>
            </td>
        </tr>
        <tr class="odd" id="pplInd" style="display:none;">
            <td class="form_label_padded" width="10%" nowrap valign="top"><s:text name="label.casefive.pplInd"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <s:select list="#attr.trueFalseList" id="caseLightModel.pplInd" name="caseLightModel.pplInd" listKey="codeId" listValue="codeDesc"
                            onchange="javascript:changeCaseFivePpl();"/>
            </td>
        </tr>
        <tr class="even" id="procInd" style="display:none;">
            <td class="form_label_padded" width="10%" nowrap valign="top"><s:text name="label.casefive.procInd"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <s:select list="#attr.trueFalseList" id="caseLightModel.procInd" name="caseLightModel.procInd" listKey="codeId" listValue="codeDesc"
                            onchange="javascript:changeCaseFiveProc();"/>
            </td>
        </tr>
        <tr class="odd" id="lightImg">
            <td class="form_label_padded" width="10%" nowrap valign="top"><s:text name="label.title.manual.lighttype"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <img src='' id="light">
            </td>
        </tr>

    </table>
    <table>
        <tr>
            <td class="txtData" colspan="3">
                <input type="button" class="button" value="<s:text name='label.save'/>" onclick="manualAdd();">
                <input type="button" class="button" value="<s:text name='label.back'/>" onclick="manualCancel();">
            </td>
        </tr>
    </table>
    <script type="text/javascript">
          changeCaseType();
    </script>
</s:form>



